package com.gxa.service.impl;

import com.gxa.mapper.CommodityDetailsMapper;
import com.gxa.pojo.CommodityDetails;
import com.gxa.service.CommodityDetailsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Author Tian同學
 * @Date 2020/9/23 21:42
 * @Version 1.0
 */
@Service("commodityDetailsService")
public class CommodityDetailsServiceImpl implements CommodityDetailsService {

    @Resource
    CommodityDetailsMapper commodityDetailsMapper;

    /**
     * 修改商品详细
     * @param map
     * @return
     */
    @Override
    @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED,rollbackFor = {Throwable.class})
    public int updateByCD(Map map) {

        return commodityDetailsMapper.updateByCD(map);
    }

    /**
     * 删除商品明细单条数据
     * @param id
     * @return
     */
    @Override
    @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED,rollbackFor = {Throwable.class})
    public int deleteByCD(Integer id) {
        return commodityDetailsMapper.deleteByCD(id);
    }

    @Override
    public int deleteByCD1(Integer id) {
        return commodityDetailsMapper.deleteByCD1(id);
    }

    /**
     * 添加商品详细
     * @param map
     * @return
     */
    @Override
    @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED,rollbackFor = {Throwable.class})
    public int insert(Map map) {
        return commodityDetailsMapper.insert(map);
    }

    @Override
    public int insert2(Map map) {
        return commodityDetailsMapper.insert2(map);
    }
}
